<?php
/**
 * 版本更新检查
 */
require_once "./libUpdate.php";

$libUpdate = new libUpdate();

//获取当前版本
$nowVersion = $libUpdate->get("v");

//获取更新标识
$identify = $libUpdate->get("identify");

//只更新zzd,ryb,xl
$identifyArray = $libUpdate->identifyArray;
if(!$nowVersion || !in_array($identify, $identifyArray)){
    $libHot->json([
        'code' => 3,
        'msg'  => "参数错误"
    ]);
}
$res = $libUpdate->checkAppUpdate($nowVersion, $identify);
if($res == -1){
    $libUpdate->json([
        'code' => 3,
        'msg'  => "不需要更新" //查找不到对应的版本更新目录
    ]);
}
if($res === TRUE){
    $libUpdate->json([
        'code' => 2,
        'msg'  => "不需要更新"
    ]);
}
$filename = $libUpdate->getFileName();
$libUpdate->json([
    'code' => 0,
    "data" => [
        'token'    => $res['data'],
        'filenum'  => $res['filenum'],
        'filename' => $filename
    ]
]);
